<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------
namespace app\user_center\behavior\user\bind_apple_before;

/**
 * 检测微信号绑定
 * @package app\user_center\behavior\user\bind_apple_before
 * @author shiqiang
 */
class checkAppleBind{
    /**
     * 执行行为 run方法是Behavior唯一的接口
     * @access public
     * @return void
     */
    public function run($params){
		$uid 	= $params['uid'];
		$apple_id  	 = $params['apple_id'];
		
		$map = [];
		$map['apple_id'] = $apple_id;
		$result = model('UcMemberApple', 'model\user') -> where($map) -> find();
		if(!empty($result)){
			$result_uid = $result->uid;
			if($uid != $result_uid){
				return array_out(-1001,'绑定失败，苹果账号已被其他用户绑定');
			}
		}
    }
}
